package demo.blog.controller;

import demo.blog.dao.CommentMapper;
import demo.blog.model.Comment;
import demo.blog.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@RestController
public class CommentController {
    @Autowired
    private CommentMapper commentMapper;


    @GetMapping("/comment")
    public Result test(){
        Comment comment = new Comment();
        comment.setUserId(1);
        comment.setContent("hahahhahaha是我asd");
        comment.setCreateDate( LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        System.out.println(commentMapper);
        //System.out.println(commentMapper.insertComment(comment));;
        return new Result(1,"sda");
    }
}
